import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
import { Task } from './task.entity';
import { TaskTemplate } from './task-template.entity';

@Entity('task_categories')
export class TaskCategory {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column({ length: 64 })
  name: string;

  @Column({ type: 'text', nullable: true })
  description: string;

  @Column({ name: 'is_deleted', default: false })
  isDeleted: boolean;

  @OneToMany(() => Task, (task) => task.taskCategory)
  tasks: Task[];

  @OneToMany(() => TaskTemplate, (template) => template.taskCategory)
  taskTemplates: TaskTemplate[];
}
